{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "bbba8dfc-38a5-4bb0-be7c-011843f0ae95",
   "metadata": {},
   "source": [
    "# Configuring Nudge Units in Position Adjustments\n",
    "\n",
    "The position adjustment `positionNudge()` now supports the `unit` parameter that specifies the measurement system for nudge offsets.  <br/>\n",
    "Equivalent parameter is also available as `nudgeUnit` in `geomText()` and `geomLabel()` directly. \n",
    "\n",
    "Available Units:\n",
    "\n",
    "- `\"identity\"` (default): nudge in data coordinates - a value of 1 corresponds to the distance from 0 to 1 on the axis\n",
    "- `\"size\"`: nudge relative to point size - a value of 1 corresponds to the diameter of a point with size 1\n",
    "- `\"px\"`: nudge in fixed pixels - a value of 1 corresponds to 1 pixel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9b462fcf-68da-4abd-aacf-595979a62133",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"UzzjVC\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.6.1/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"UzzjVC\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"UzzjVC\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "            <div id=\"kotlin_out_0\"></div>\n",
       "            <script type=\"text/javascript\">\n",
       "                            if(!window.kotlinQueues) {\n",
       "                window.kotlinQueues = {};\n",
       "            }\n",
       "            if(!window.kotlinQueues[\"letsPlotJs\"]) {\n",
       "                var resQueue = [];\n",
       "                window.kotlinQueues[\"letsPlotJs\"] = resQueue;\n",
       "                window[\"call_letsPlotJs\"] = function(f) {\n",
       "                    resQueue.push(f);\n",
       "                }\n",
       "            }\n",
       "            (function (){\n",
       "                var modifiers = [(function(script) {\n",
       "    script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.6.1/js-package/distr/lets-plot.min.js\"\n",
       "    script.type = \"text/javascript\";\n",
       "})];\n",
       "                var e = document.getElementById(\"kotlin_out_0\");\n",
       "                modifiers.forEach(function (gen) {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    gen(script)\n",
       "                    script.addEventListener(\"load\", function() {\n",
       "                        window[\"call_letsPlotJs\"] = function(f) {f();};\n",
       "                        window.kotlinQueues[\"letsPlotJs\"].forEach(function(f) {f();});\n",
       "                        window.kotlinQueues[\"letsPlotJs\"] = [];\n",
       "                    }, false);\n",
       "                    script.addEventListener(\"error\", function() {\n",
       "                        window[\"call_letsPlotJs\"] = function(f) {};\n",
       "                        window.kotlinQueues[\"letsPlotJs\"] = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading resource letsPlotJs';\n",
       "                        document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
       "                    }, false);\n",
       "                    \n",
       "                    e.appendChild(script);\n",
       "                });\n",
       "            })();\n",
       "            </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use lets-plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ecabca69-383a-46d8-afb0-01d42d0a408e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Lets-Plot Kotlin API v.4.10.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.6.1."
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "LetsPlot.getInfo()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3ceb8835-e571-4aac-94c6-310f2011a5a8",
   "metadata": {},
   "source": [
    "#### 1. Without nudge"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ea4c9641-75e2-463d-bd12-560d3bb96af8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"KWi1DO\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.6.1/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"KWi1DO\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"KWi1DO\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "ggsize": {
         "height": 300,
         "width": 400
        },
        "kind": "plot",
        "layers": [
         {
          "color": "#DA8459",
          "geom": "point",
          "mapping": {},
          "position": "identity",
          "size": 10,
          "stat": "identity",
          "x": 0,
          "y": 0
         },
         {
          "geom": "text",
          "label": "text without nudge",
          "mapping": {},
          "position": "identity",
          "stat": "identity",
          "x": 0,
          "y": 0
         }
        ],
        "mapping": {},
        "scales": []
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"pdMbj2\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"pdMbj2\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":300.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#DA8459\",\n",
       "\"size\":10.0,\n",
       "\"x\":0.0,\n",
       "\"y\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"x\":0.0,\n",
       "\"y\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"label\":\"text without nudge\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"spec_id\":\"1\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=5cfa73ef-4c83-4113-9e68-9bacc7146503 width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 300.0px;\" viewBox=\"0 0 400.0 300.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: Lucida Grande, sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#przYqhF .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "   font-style: normal;\n",
       "}\n",
       "#przYqhF .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d4GE5yW .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d4GE5yW .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#przYqhF .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d4GE5yW .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d4GE5yW .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d4GE5yW .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"przYqhF\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 300.0 L400.0 300.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(29.5 6.5 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"32.89846933242504\" y1=\"0.0\" x2=\"32.89846933242504\" y2=\"241.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"98.69540799727511\" y1=\"0.0\" x2=\"98.69540799727511\" y2=\"241.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"164.4923466621252\" y1=\"0.0\" x2=\"164.4923466621252\" y2=\"241.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"230.28928532697526\" y1=\"0.0\" x2=\"230.28928532697526\" y2=\"241.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"296.08622399182536\" y1=\"0.0\" x2=\"296.08622399182536\" y2=\"241.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"0.0\" y1=\"216.9\" x2=\"328.9846933242504\" y2=\"216.9\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"168.7\" x2=\"328.9846933242504\" y2=\"168.7\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"120.5\" x2=\"328.9846933242504\" y2=\"120.5\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"72.3\" x2=\"328.9846933242504\" y2=\"72.3\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"24.099999999999994\" x2=\"328.9846933242504\" y2=\"24.099999999999994\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cjqoB6r)\" clip-bounds-jfx=\"[rect (35.01530667574961, 0.0), (328.9846933242504, 241.0)]\">\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#da8459\" stroke=\"#da8459\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"164.4923466621252\" cy=\"120.5\" r=\"11.0\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 164.4923466621252 120.5 ) \">\n",
       "                <g transform=\"translate(164.4923466621252 124.7 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>text without nudge</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"c842nY9\">\n",
       "            <rect x=\"35.01530667574961\" y=\"0.0\" width=\"328.9846933242504\" height=\"241.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cjqoB6r\">\n",
       "            <rect x=\"35.01530667574961\" y=\"0.0\" width=\"328.9846933242504\" height=\"241.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(35.01530667574961 241.0 ) \">\n",
       "          <g transform=\"translate(32.89846933242504 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>-0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(98.69540799727511 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>-0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(164.4923466621252 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(230.28928532697526 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(296.08622399182536 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <line x1=\"0.0\" y1=\"0.0\" x2=\"328.9846933242504\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
       "          </line>\n",
       "        </g>\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g transform=\"translate(0.0 216.9 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>-0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 168.7 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>-0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 120.5 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 72.3 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 24.099999999999994 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(16.0 127.0 ) rotate(-90.0 ) \">\n",
       "      <text class=\"axis-title-y\" y=\"0.0\" text-anchor=\"middle\">\n",
       "        <tspan>y</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(229.00765333787479 293.0 ) \">\n",
       "      <text class=\"axis-title-x\" y=\"0.0\" text-anchor=\"middle\">\n",
       "        <tspan>x</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 300.0 L400.0 300.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"d4GE5yW\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"5cfa73ef-4c83-4113-9e68-9bacc7146503\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "letsPlot() + \n",
    "    geomPoint(x = 0, y = 0, size = 10, color = \"#DA8459\") + \n",
    "    geomText(x = 0, y = 0, label = \"text without nudge\") + \n",
    "    ggsize(400, 300)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1e8597bb-2986-429c-bab3-26a58f89bddf",
   "metadata": {},
   "source": [
    "#### 2. Unit Comparison: Pixel, Size, and Identity\n",
    "\n",
    "The `\"size\"` unit enables precise positioning relative to point dimensions.\n",
    "\n",
    "In this example, the point has `size = 30` and text is positioned at half that distance (`nudgeY = 15`). When combined with `vjust`/`hjust`, this allows for placing text at specific locations relative to the point boundary."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8acd87f8-94f4-4d5a-81a6-a2e5a0e8a71f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color": "#B9534C",
          "geom": "point",
          "mapping": {},
          "position": "identity",
          "size": 5,
          "stat": "identity",
          "x": 0,
          "y": 1
         },
         {
          "geom": "text",
          "label": "identity 0.2",
          "mapping": {},
          "nudge_y": 0.2,
          "position": "identity",
          "stat": "identity",
          "x": 0,
          "y": 1
         },
         {
          "color": "#DA8459",
          "geom": "point",
          "mapping": {},
          "position": "identity",
          "size": 5,
          "stat": "identity",
          "x": 1,
          "y": 1
         },
         {
          "geom": "text",
          "label": "px 40",
          "mapping": {},
          "nudge_unit": "px",
          "nudge_y": 40,
          "position": "identity",
          "stat": "identity",
          "x": 1,
          "y": 1
         },
         {
          "color": "#EEAB65",
          "geom": "point",
          "mapping": {},
          "position": "identity",
          "size": 30,
          "stat": "identity",
          "x": 2,
          "y": 1
         },
         {
          "geom": "text",
          "label": "size 15",
          "mapping": {},
          "nudge_unit": "size",
          "nudge_y": 15,
          "position": "identity",
          "stat": "identity",
          "x": 2,
          "y": 1
         },
         {
          "color": "#F6C971",
          "geom": "point",
          "mapping": {},
          "position": "identity",
          "size": 30,
          "stat": "identity",
          "x": 3,
          "y": 1
         },
         {
          "geom": "text",
          "label": "size 15 vjust 0",
          "mapping": {},
          "nudge_unit": "size",
          "nudge_y": 15,
          "position": "identity",
          "stat": "identity",
          "vjust": 0,
          "x": 3,
          "y": 1
         },
         {
          "geom": "text",
          "label": "size -15 vjust 1",
          "mapping": {},
          "nudge_unit": "size",
          "nudge_y": -15,
          "position": "identity",
          "stat": "identity",
          "vjust": 1,
          "x": 3,
          "y": 1
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "x",
          "limits": [
           -1,
           4
          ]
         }
        ]
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"wVxtfV\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"wVxtfV\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"limits\":[-1.0,4.0]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#B9534C\",\n",
       "\"size\":5.0,\n",
       "\"x\":0.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"nudge_y\":0.2,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"x\":0.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"label\":\"identity 0.2\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#DA8459\",\n",
       "\"size\":5.0,\n",
       "\"x\":1.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"nudge_y\":40.0,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"x\":1.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"label\":\"px 40\",\n",
       "\"geom\":\"text\",\n",
       "\"nudge_unit\":\"px\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#EEAB65\",\n",
       "\"size\":30.0,\n",
       "\"x\":2.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"nudge_y\":15.0,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"x\":2.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"label\":\"size 15\",\n",
       "\"geom\":\"text\",\n",
       "\"nudge_unit\":\"size\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#F6C971\",\n",
       "\"size\":30.0,\n",
       "\"x\":3.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"nudge_y\":15.0,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"vjust\":0.0,\n",
       "\"x\":3.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"label\":\"size 15 vjust 0\",\n",
       "\"geom\":\"text\",\n",
       "\"nudge_unit\":\"size\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"nudge_y\":-15.0,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"vjust\":1.0,\n",
       "\"x\":3.0,\n",
       "\"y\":1.0,\n",
       "\"position\":\"identity\",\n",
       "\"label\":\"size -15 vjust 1\",\n",
       "\"geom\":\"text\",\n",
       "\"nudge_unit\":\"size\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"spec_id\":\"3\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=ac500ec7-a7ef-4196-b36e-e72aa0e9920b width=\"100%\" height=\"100%\" style=\"max-width: 600.0px; max-height: 400.0px;\" viewBox=\"0 0 600.0 400.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: Lucida Grande, sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#ptamZPq .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "   font-style: normal;\n",
       "}\n",
       "#ptamZPq .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d8pVplY .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d8pVplY .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptamZPq .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d8pVplY .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d8pVplY .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d8pVplY .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"ptamZPq\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(29.5 6.5 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(27.034701220281416 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"24.407513580896307\" y1=\"0.0\" x2=\"24.407513580896307\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"122.03756790448152\" y1=\"0.0\" x2=\"122.03756790448152\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"219.66762222806673\" y1=\"0.0\" x2=\"219.66762222806673\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"317.29767655165193\" y1=\"0.0\" x2=\"317.29767655165193\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"414.92773087523716\" y1=\"0.0\" x2=\"414.92773087523716\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"512.5577851988223\" y1=\"0.0\" x2=\"512.5577851988223\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"translate(27.034701220281416 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"0.0\" y1=\"306.9\" x2=\"536.9652987797186\" y2=\"306.9\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"238.7\" x2=\"536.9652987797186\" y2=\"238.7\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"170.5\" x2=\"536.9652987797186\" y2=\"170.5\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"102.30000000000001\" x2=\"536.9652987797186\" y2=\"102.30000000000001\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"34.10000000000002\" x2=\"536.9652987797186\" y2=\"34.10000000000002\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#clNJYBp)\" clip-bounds-jfx=\"[rect (27.034701220281416, 0.0), (536.9652987797186, 341.0)]\">\n",
       "        <g transform=\"translate(27.034701220281416 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#b9534c\" stroke=\"#b9534c\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"122.03756790448152\" cy=\"170.5\" r=\"5.5\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 122.03756790448152 102.30000000000001 ) \">\n",
       "                <g transform=\"translate(122.03756790448152 106.50000000000001 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>identity 0.2</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#da8459\" stroke=\"#da8459\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"219.66762222806673\" cy=\"170.5\" r=\"5.5\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 219.66762222806676 130.50000000000006 ) \">\n",
       "                <g transform=\"translate(219.66762222806676 134.70000000000005 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>px 40</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#eeab65\" stroke=\"#eeab65\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"317.29767655165193\" cy=\"170.5\" r=\"33.0\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 317.29767655165193 137.50000000000006 ) \">\n",
       "                <g transform=\"translate(317.29767655165193 141.70000000000005 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>size 15</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#f6c971\" stroke=\"#f6c971\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"414.92773087523716\" cy=\"170.5\" r=\"33.0\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 414.9277308752372 137.50000000000006 ) \">\n",
       "                <g transform=\"translate(414.9277308752372 137.50000000000006 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>size 15 vjust 0</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 414.9277308752372 203.5 ) \">\n",
       "                <g transform=\"translate(414.9277308752372 213.3 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>size -15 vjust 1</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cYuVRvU\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cERzFBq\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cti7k6l\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cm2EqZ5\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"c3lqjfA\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cOwfhoX\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cTF17tL\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"cQmnhC0\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"clNJYBp\">\n",
       "            <rect x=\"27.034701220281416\" y=\"0.0\" width=\"536.9652987797186\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(27.034701220281416 341.0 ) \">\n",
       "          <g transform=\"translate(24.407513580896307 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>-1</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(122.03756790448152 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(219.66762222806673 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>1</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(317.29767655165193 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(414.92773087523716 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>3</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(512.5577851988223 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <line x1=\"0.0\" y1=\"0.0\" x2=\"536.9652987797186\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
       "          </line>\n",
       "        </g>\n",
       "        <g transform=\"translate(27.034701220281416 0.0 ) \">\n",
       "          <g transform=\"translate(0.0 306.9 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0.6</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 238.7 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0.8</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 170.5 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>1</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 102.30000000000001 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>1.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 34.10000000000002 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>1.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(16.0 177.0 ) rotate(-90.0 ) \">\n",
       "      <text class=\"axis-title-y\" y=\"0.0\" text-anchor=\"middle\">\n",
       "        <tspan>y</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(325.01735061014074 393.0 ) \">\n",
       "      <text class=\"axis-title-x\" y=\"0.0\" text-anchor=\"middle\">\n",
       "        <tspan>x</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"d8pVplY\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"ac500ec7-a7ef-4196-b36e-e72aa0e9920b\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "letsPlot() +\n",
    "    xlim(-1 to 4) +\n",
    "    geomPoint(x = 0, y = 1, size = 5, color = \"#B9534C\") +\n",
    "    geomText(x = 0, y = 1, label = \"identity 0.2\", nudgeY = 0.2) +\n",
    "    geomPoint(x = 1, y = 1, size = 5, color = \"#DA8459\") +\n",
    "    geomText(x = 1, y = 1, label = \"px 40\", nudgeY = 40, nudgeUnit = \"px\") +\n",
    "    geomPoint(x = 2, y = 1, size = 30, color = \"#EEAB65\") +\n",
    "    geomText(x = 2, y = 1, label = \"size 15\", nudgeY = 15, nudgeUnit = \"size\") +\n",
    "    geomPoint(x = 3, y = 1, size = 30, color = \"#F6C971\") +\n",
    "    geomText(x = 3, y = 1, label = \"size 15 vjust 0\", nudgeY = 15, vjust = 0, nudgeUnit = \"size\") +\n",
    "    geomText(x = 3, y = 1, label = \"size -15 vjust 1\", nudgeY = -15, vjust = 1, nudgeUnit = \"size\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b8f317a8-5aec-4ba7-8646-cbad83c13742",
   "metadata": {},
   "source": [
    "#### 3. Parameter `unit` in `positionNudge()`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7abb1d30-0e36-409a-bad4-acd11b86c9b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color": "#DA8459",
          "geom": "point",
          "mapping": {},
          "position": "identity",
          "size": 50,
          "stat": "identity",
          "x": 0,
          "y": 0
         },
         {
          "color": "blue",
          "geom": "point",
          "mapping": {},
          "position": {
           "name": "nudge",
           "unit": "size",
           "x": 0,
           "y": 25
          },
          "size": 20,
          "stat": "identity",
          "x": 0,
          "y": 0
         },
         {
          "geom": "text",
          "label": "positionNudge size 25",
          "mapping": {},
          "position": {
           "name": "nudge",
           "unit": "size",
           "x": 50,
           "y": 25
          },
          "stat": "identity",
          "x": 0,
          "y": 0
         }
        ],
        "mapping": {},
        "scales": []
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"rfW0YB\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"rfW0YB\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#DA8459\",\n",
       "\"size\":50.0,\n",
       "\"x\":0.0,\n",
       "\"y\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"blue\",\n",
       "\"size\":20.0,\n",
       "\"x\":0.0,\n",
       "\"y\":0.0,\n",
       "\"position\":{\n",
       "\"name\":\"nudge\",\n",
       "\"x\":0.0,\n",
       "\"y\":25.0,\n",
       "\"unit\":\"size\"\n",
       "},\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"x\":0.0,\n",
       "\"y\":0.0,\n",
       "\"position\":{\n",
       "\"name\":\"nudge\",\n",
       "\"x\":50.0,\n",
       "\"y\":25.0,\n",
       "\"unit\":\"size\"\n",
       "},\n",
       "\"label\":\"positionNudge size 25\",\n",
       "\"geom\":\"text\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"spec_id\":\"5\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=774db43b-0819-4214-8937-d21b2db191ea width=\"100%\" height=\"100%\" style=\"max-width: 600.0px; max-height: 400.0px;\" viewBox=\"0 0 600.0 400.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: Lucida Grande, sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#p6mHq7Z .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "   font-style: normal;\n",
       "}\n",
       "#p6mHq7Z .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dxr8vnJ .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dxr8vnJ .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p6mHq7Z .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dxr8vnJ .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dxr8vnJ .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dxr8vnJ .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "   font-style: normal;font-family: Lucida Grande, sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"p6mHq7Z\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(29.5 6.5 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"52.89846933242504\" y1=\"0.0\" x2=\"52.89846933242504\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"158.69540799727514\" y1=\"0.0\" x2=\"158.69540799727514\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"264.4923466621252\" y1=\"0.0\" x2=\"264.4923466621252\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"370.2892853269753\" y1=\"0.0\" x2=\"370.2892853269753\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"476.08622399182536\" y1=\"0.0\" x2=\"476.08622399182536\" y2=\"341.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"0.0\" y1=\"306.9\" x2=\"528.9846933242504\" y2=\"306.9\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"238.7\" x2=\"528.9846933242504\" y2=\"238.7\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"170.5\" x2=\"528.9846933242504\" y2=\"170.5\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"102.3\" x2=\"528.9846933242504\" y2=\"102.3\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"34.099999999999994\" x2=\"528.9846933242504\" y2=\"34.099999999999994\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#c03qpj9)\" clip-bounds-jfx=\"[rect (35.01530667574961, 0.0), (528.9846933242504, 341.0)]\">\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#da8459\" stroke=\"#da8459\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"264.4923466621252\" cy=\"170.5\" r=\"55.00000000000001\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <g >\n",
       "                  <circle fill=\"#0000ff\" stroke=\"#0000ff\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"264.4923466621252\" cy=\"115.5\" r=\"22.0\" />\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g>\n",
       "              <g transform=\"rotate(0.0 374.4923466621252 115.5 ) \">\n",
       "                <g transform=\"translate(374.4923466621252 119.7 ) \">\n",
       "                  <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" fill-opacity=\"1.0\" y=\"0.0\" text-anchor=\"middle\">\n",
       "                    <tspan>positionNudge size 25</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cQpBYvw\">\n",
       "            <rect x=\"35.01530667574961\" y=\"0.0\" width=\"528.9846933242504\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"c7Or7xR\">\n",
       "            <rect x=\"35.01530667574961\" y=\"0.0\" width=\"528.9846933242504\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "        <defs>\n",
       "          <clipPath id=\"c03qpj9\">\n",
       "            <rect x=\"35.01530667574961\" y=\"0.0\" width=\"528.9846933242504\" height=\"341.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(35.01530667574961 341.0 ) \">\n",
       "          <g transform=\"translate(52.89846933242504 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>-0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(158.69540799727514 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>-0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(264.4923466621252 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(370.2892853269753 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(476.08622399182536 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 7.0 ) \">\n",
       "              <text class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\" y=\"0.0\">\n",
       "                <tspan>0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <line x1=\"0.0\" y1=\"0.0\" x2=\"528.9846933242504\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
       "          </line>\n",
       "        </g>\n",
       "        <g transform=\"translate(35.01530667574961 0.0 ) \">\n",
       "          <g transform=\"translate(0.0 306.9 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>-0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 238.7 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>-0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 170.5 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 102.3 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 34.099999999999994 ) \">\n",
       "            <g transform=\"translate(-3.0 0.0 ) \">\n",
       "              <text class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\" y=\"0.0\">\n",
       "                <tspan>0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(16.0 177.0 ) rotate(-90.0 ) \">\n",
       "      <text class=\"axis-title-y\" y=\"0.0\" text-anchor=\"middle\">\n",
       "        <tspan>y</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(329.00765333787484 393.0 ) \">\n",
       "      <text class=\"axis-title-x\" y=\"0.0\" text-anchor=\"middle\">\n",
       "        <tspan>x</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dxr8vnJ\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"774db43b-0819-4214-8937-d21b2db191ea\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "letsPlot() + \n",
    "    geomPoint(x = 0, y = 0, size = 50, color = \"#DA8459\") + \n",
    "    geomPoint(x = 0, y = 0, size = 20, color = \"blue\", position = positionNudge(0, 25, \"size\")) + \n",
    "    geomText(x = 0, y = 0, label = \"positionNudge size 25\", position = positionNudge(50, 25, \"size\"))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.9.23"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
